public class Demo4 {
    private static boolean isQuit = false;
    public static void main(String[] args) {
        Thread thread = new Thread(() ->{
            while(!isQuit) {

            }
        });
        thread.start();
        isQuit = true;
    }
}
